package com.gzc.utils
{
	import flash.display.BitmapData;
	import flash.display.Graphics;
	
	public class GraphicsUtil
	{
		public function GraphicsUtil()
		{
			
		}
		
		public static function drawRectBitmap(graphics:Graphics, bitmapData:BitmapData, x:Number, y:Number):void{
			graphics.clear();
			graphics.beginBitmapFill(bitmapData);
			graphics.drawRect(x, y, bitmapData.width, bitmapData.height);
			graphics.endFill();
		}
		
		public static function drawRect(graphics:Graphics, x:Number, y:Number, width:Number, height:Number,
										  color:uint, alpha:Number=1,
										  lineThickness:Number=0, lineColor:uint=0, lineAlpha:Number=1):void{
			graphics.clear();
			graphics.lineStyle(lineThickness, lineColor, lineAlpha);
			graphics.beginFill(color, alpha);
			graphics.drawRect(x, y, width, height);
			graphics.endFill();
		}
		
		public static function drawCircle(graphics:Graphics, x:Number, y:Number, radius:Number,
										  color:uint, alpha:Number=1,
										  lineThickness:Number=0, lineColor:uint=0, lineAlpha:Number=1):void{
			graphics.clear();
			graphics.lineStyle(lineThickness, lineColor, lineAlpha);
			graphics.beginFill(color, alpha);
			graphics.drawCircle(x, y, radius);
			graphics.endFill();
		}
		
		public static function clear(graphics:Graphics):void{
			graphics.clear();
		}
		
	}
}